package com.banmoon.decorator.myimpl.coffee;

public class LongBlack extends Coffee{

    public LongBlack() {
        setPrice(10F);
        setName("美式咖啡");
    }

    @Override
    public Float cost() {
        Float price = getPrice();
        price += getSugar()==null? 0F: getSugar().getPrice();
        price += getMilk()==null? 0F: getMilk().getPrice();
        price += getChocolate()==null? 0F: getChocolate().getPrice();
        return price;
    }

    @Override
    public String getDesc() {
        String desc = getName();
        if(getSugar()!=null)
            desc += " && " + getSugar().getName() + " " + getSugar().getPrice();
        if(getMilk()!=null)
            desc += " && " + getMilk().getName() + " " + getMilk().getPrice();
        if(getChocolate()!=null)
            desc += " && " + getChocolate().getName() + " " + getChocolate().getPrice();
        return desc;
    }
}
